<template>
  <view class="load_more_comp"><u-loadmore :status="finished ? 'nomore' : 'loading'" bg-color="transparent" :load-text="loadText" /></view>
</template>

<script>
export default {
  components: {},
  props: {
    itemList: { // 列表数据，用作判断列表长度
      type: Array,
      default: () => []
    },
    finished: {
      type: Boolean,
      default: false
    },
    loadmoreTxt: {
      type: String,
      default: '下拉加载更多'
    },
    loadingTxt: {
      type: String,
      default: '努力加载中'
    },
    nomoreTxt: {
      type: String,
      default: '加载完毕'
    },
    noDataTxt: { //空数据时的展示文案
      type: String,
      default: '加载完毕'
    }
  },
  data() {
    return {
      loadText: {
        loadmore: this.loadmoreTxt,
        loading: this.loadingTxt,
        nomore: this.nomoreTxt
      }
    };
  },
  watch:{
    itemList(list){
      if(list.length === 0){
        // 空数据展示文案
        this.loadText.nomore = this.noDataTxt
      }else{
        this.loadText.nomore = this.nomoreTxt
      }
    }
  },
  created() {
  },
  methods: {}
};
</script>

<style scoped lang="scss">
.load_more_comp {
  font-size: 25rpx;
  font-family: SourceHanSansSC-Regular, SourceHanSansSC;
  font-weight: 400;
  color: #828282;
  line-height: 35rpx;
}
</style>
